import store from '@/store'
import custom_dict from '@/store/modules/custom_dict'

export const formItemStyle = {
  paddingLeft: '20px',
  marginBottom: '10px'
}

export const cellStyle = {
  background: 'rgba(28, 155, 252, 0.02)',
  color: 'rgb(142, 155, 185)',
  textAlign: 'center',
}

// 表头单元格样式
export const headerCellStyle = {
  background: 'rgba(28, 155, 252, 0.02)',
  color: 'rgb(142, 155, 185)',
  textAlign: 'center'
}

// 表格内表单子样式
export const tableFormStyle = {
  marginBottom: 0
}

// 表单配置项
export const formBase = [
  {
    type: 'daterange',
    field: 'Time',
    label: '日期',
    otherOptions: {
      disabled: false,
      rangeSeparator: '至',
      startPlaceholder: '开始日期',
      endPlaceholder: '结束日期',
      pickerOptions: {
        shortcuts: [{
          text: '昨天',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '三天',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 3);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '一周',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '一月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit('pick', [start, end]);
          }
        }]
      }
    }
  },
  {
    type: 'input',
    field: 'courierNumber',
    label: '快递单号',
    otherOptions: {}
  },
  {
    type: 'input',
    field: 'userId',
    label: '会员ID',
    otherOptions: {}
  },
  {
    type: 'select',
    field: 'shopId',
    label: '店铺名称',
    optionsKey: 'shopName',
    optionsValue: 'id',
    options: [
      {
        id: 1,
        shopName: '佰茂值通云仓'
      }, {
        id: 2,
        shopName: '无主'
      }, {
        id: 3,
        shopName: '不限'
      }
    ],
    otherOptions: {
      disabled: false
    }
  },
  {
    type: 'input',
    field: 'userName',
    label: '会员昵称',
    otherOptions: {}
  },
  {
    type: 'select',
    field: 'companyId',
    label: '快递公司',
    optionsKey: 'companyName',
    optionsValue: 'id',
    options: store.state.custom_dict.company,
    otherOptions: {
      disabled: false
    }
  }
]

// 表格配置项
export const tableBase = [
  {
    label: '会员ID',
    prop: 'userId'
  },
  {
    label: '会员昵称',
    prop: 'userName'
  },
  {
    label: '登记时间',
    prop: 'createTime'
  },
  {
    label: '快递单号',
    prop: 'courierNumber'
  },
  {
    label: '快递公司',
    prop: 'companyName'
  },
  {
    label: '货物品名',
    prop: 'cargoName'
  },
  {
    label: '店铺名称',
    prop: 'shopName'
  },
  {
    label: '垫付费',
    prop: 'advancePayment'
  },
  {
    label: '备注',
    prop: 'remarks'
  }
]
